package com.mxpio.erp.common.sales.entity;

import java.math.BigDecimal;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.mxpio.erp.common.jpa.model.BizOrder;
import com.mxpioframework.security.annotation.Dict;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_SALES_SO")
@ApiModel(value="销售订单")
public class SalesOrder extends BizOrder {

	private static final long serialVersionUID = 1L;

	@Column(name = "ORDER_TYPE_")
	@ApiModelProperty(value = "单据类型")
	@Dict(dicCode="ERP_SALES_ORDER_TYPE")
	private String orderType ;

	@Column(name = "BIZ_TYPE_")
	@ApiModelProperty(value = "业务类型")
	@Dict(dicCode = "ERP_SALES_BIZ_TYPE")
	private String bizType;

	@Column(name = "CONTRACT_YEAR_")
	@ApiModelProperty(value = "合同年份")
	private Integer contractYear ;

	@Column(name = "CONTRACT_REVIEW_")
	@ApiModelProperty(value = "合同评审")
	private String contractReview ;

	@Column(name = "CONTRACT_NO_")
	@ApiModelProperty(value = "合同编号")
	private String contractNo ;

	@Column(name = "IN_CONTRACT_NO_")
	@ApiModelProperty(value = "厂内合同编号")
	private String inContractNo ;

	@Column(name = "SALESMAN_")
	@ApiModelProperty(value = "业务员")
	private String salesman ;

	@Column(name = "CST_CODE_")
	@ApiModelProperty(value = "客户编号")
	private String cstCode ;

	@Column(name = "CST_NAME_")
	@ApiModelProperty(value = "客户名称")
	private String cstName ;

	@Column(name = "CST_CONTACTS_")
	@ApiModelProperty(value = "客户联系人")
	private String cstContacts ;

	@Column(name = "CST_ADDRESS_")
	@ApiModelProperty(value = "客户地址")
	private String cstAddress ;

	@Column(name = "CST_CONTACT_INFO_")
	@ApiModelProperty(value = "联系方式")
	private String cstContactInfo ;

	@Column(name = "INVOICE_TYPE_")
	@ApiModelProperty(value = "发票类型")
	@Dict(dicCode = "ERP_SALES_INVOICE_TYPE")
	private String invoiceType ;

	@Column(name = "TAX_RATE_")
	@ApiModelProperty(value = "税率")
	private BigDecimal taxRate ;

	@Column(name = "EXCHANGE_RATE_")
	@ApiModelProperty(value = "汇率")
	private BigDecimal exchangeRate ;

	@Column(name = "CURRENCY_")
	@ApiModelProperty(value = "币种")
	@Dict(dicCode = "ERP_COMMON_CURRENCY")
	private String currency ;

	@Column(name = "RECEIVING_COMPANY_")
	@ApiModelProperty(value = "收货单位")
	private String receivingCompany ;

	@Column(name = "RECEIVING_ADDRESS_")
	@ApiModelProperty(value = "收货地址")
	private String receivingAddress ;

	@Column(name = "RECEIVER_")
	@ApiModelProperty(value = "收货人")
	private String receiver ;

	@Column(name = "RECEIVER_PHONE_")
	@ApiModelProperty(value = "收货人手机")
	private String receiverContacts ;

	@Column(name = "MEMO_")
	@ApiModelProperty(value = "备注")
	private String memo;

	@Transient
	private List<SalesOrderLine> salesOrderLines;
	
	
	@Override
	public String initTypeCode() {
		return "SO1";
	}
}
